package com.innovativethinking.web.di;

import com.google.inject.Guice;
import com.google.inject.Injector;
import com.google.inject.servlet.GuiceServletContextListener;
import com.google.inject.servlet.ServletModule;
import com.innovativethinking.web.servlet.BufferSizeServlet;
import com.innovativethinking.web.servlet.KanbanLifecycleServlet;
import com.innovativethinking.web.servlet.KanbanTweetServlet;
import com.innovativethinking.web.servlet.LogOutServlet;

public class GuiceBootstrapperListener extends GuiceServletContextListener {

	@Override
	protected Injector getInjector() {
		
		return Guice.createInjector(new ServletModule() {			
			@Override
		    protected void configureServlets() {
				
				install(new KanbanTweetServiceModule());
				
				serve("index.jsp").with(KanbanTweetServlet.class);				
				serve("/logOut").with(LogOutServlet.class);				
				serve("/kanbantweet").with(KanbanTweetServlet.class);				
				serve("/previousBuffer", "/nextBuffer", "/notToDoBuffer").with(KanbanLifecycleServlet.class);
				serve("/bufferSize").with(BufferSizeServlet.class);
				
			}
		});		
	}	
}
